/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.aptech.campaign.entities;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 *
 * @author Tai Nguyen
 */
public class ActualBudget {

    private int campaignID;
    private int soldAmount;
    private float actualSale;
    private float actualBudget;
    private float saleVariance;
    private float budgetVariance;
    private String lastError;
    /**
     *
     * @param soldAmount
     * @param actualSale
     * @param actualBudget
     * @return boolean value
     */
     

    public boolean validate(String soldAmount, String actualSale, String actualBudget) {
        Pattern pattern = Pattern.compile("[0-9]+[.]?[0-9]+");
        Matcher m1 = pattern.matcher(soldAmount);
        Matcher m2 = pattern.matcher(actualSale);
        Matcher m3 = pattern.matcher(actualBudget);

        if (!m1.matches() || !m2.matches() || !m3.matches()) {
            setLastError("Please Enter number values!");
            return false;
        }
        return true;
    }

    /**
     * @return the campaignID
     */
    public int getCampaignID() {
        return campaignID;
    }

    /**
     * @param campaignID the campaignID to set
     */
    public void setCampaignID(int campaignID) {
        this.campaignID = campaignID;
    }

    /**
     * @return the soldAmount
     */
    public int getSoldAmount() {
        return soldAmount;
    }

    /**
     * @param soldAmount the soldAmount to set
     */
    public void setSoldAmount(int soldAmount) {
        this.soldAmount = soldAmount;
    }

    /**
     * @return the actualBudget
     */
    public float getActualBudget() {
        return actualBudget;
    }

    /**
     * @param actualBudget the actualBudget to set
     */
    public void setActualBudget(float actualBudget) {
        this.actualBudget = actualBudget;
    }

    /**
     * @return the saleVariance
     */
    public float getSaleVariance() {
        return saleVariance;
    }

    /**
     * @param saleVariance the saleVariance to set
     */
    public void setSaleVariance(float saleVariance) {
        this.saleVariance = saleVariance;
    }

    /**
     * @return the budgetVariance
     */
    public float getBudgetVariance() {
        return budgetVariance;
    }

    /**
     * @param budgetVariance the budgetVariance to set
     */
    public void setBudgetVariance(float budgetVariance) {
        this.budgetVariance = budgetVariance;
    }

    /**
     * @return the actualSale
     */
    public float getActualSale() {
        return actualSale;
    }

    /**
     * @param actualSale the actualSale to set
     */
    public void setActualSale(float actualSale) {
        this.actualSale = actualSale;
    }

    /**
     * @return the lastError
     */
    public String getLastError() {
        return lastError;
    }

    /**
     * @param lastError the lastError to set
     */
    public void setLastError(String lastError) {
        this.lastError = lastError;
    }
}
